package cn.ekuma.epos.inventory;

import com.openbravo.bean.sales.PosSharedProduct;
import com.openbravo.data.basic.BasicException;
import com.openbravo.data.gui.MessageInf;
import com.openbravo.data.user.DirtyManager;
import com.openbravo.pos.base.AppView;
import com.openbravo.pos.base.BeanFactoryException;
import com.openbravo.pos.panels.event.TimeCycleChangedEvent;

import cn.ekuma.data.ui.swing.AbstractDAOJEditor;
import cn.ekuma.epos.core.model.AbstractDLSaleDTOTableModel;
import cn.ekuma.epos.inventory.model.PosSharedProductTableModel;
import cn.ekuma.epos.module.ERP_UI_Swing_Model;
import cn.ekuma.epos.panel.AbstractSingleJModelFinishingPanel;

public class JPosSharedProductsPanel extends AbstractSingleJModelFinishingPanel<PosSharedProduct>{

	public JPosSharedProductsPanel() {
		super(new PosSharedProductTableModel());
		// TODO Auto-generated constructor stub
	}

	@Override
	public String getTitle() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Object createValue() throws BasicException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void timeCycleChanged(TimeCycleChangedEvent e) {
		// TODO Auto-generated method stub
		
	}

	@Override
	protected void initFinishPanel(AppView app) throws BeanFactoryException {
		((AbstractDLSaleDTOTableModel)tableModel).setDlSales(mode.getDLERP());
		
	}

	@Override
	public void reQuery() {
		try {
			tableModel.resert(dlSales.list(PosSharedProduct.class));
		} catch (BasicException e) {
			new MessageInf(e).show(this);
		}
	}

	@Override
	protected AbstractDAOJEditor<PosSharedProduct> getEditor() {
		return new JPosSharedProductEditor(mode.getDLERP(), new DirtyManager());
	}

	@Override
	public String getModelName() {
		return ERP_UI_Swing_Model.MODEL_NAME;
	}	
}
